<!DOCTYPE html>
<html>
<head>
    <meta name="viewport" content="width=device-width, minimum-scale=1, initial-scale=1.0, maximum-scale=1, user-scalable=no" charset="UTF-8">
    <link rel="stylesheet" type="text/css" href="/app/css/media.css"/>
    <link rel="stylesheet" type="text/css" href="/app/css/common.css"/>

    <title>云专线</title>
    <link href="/app/css/mui.picker.css" rel="stylesheet" />
    <link href="/app/css/mui.poppicker.css" rel="stylesheet" />
    <link rel="stylesheet" type="text/css" href="/app/css/index.css"/>
    <script src="//do.yunzhijia.com/pub/js/qingjs.js"></script>
    <link href="//cdn.bootcss.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet">
    <link href="//cdn.bootcss.com/bootstrap-slider/9.4.1/css/bootstrap-slider.css" rel="stylesheet">
    <link rel="stylesheet" type="text/css" href="/app/css/index.css"/>
    <script src="/app/js/jquery-3.0.0.min.js"></script>
    <script src="/layer/layer.js"></script>
    <script src="http://cdn.bootcss.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
    <script src="http://cdn.bootcss.com/bootstrap-slider/9.4.1/bootstrap-slider.min.js"></script>

</head>
<body style="background: #eaeff3;>
<div class="main_div">
<div class="main_body" style="height: 580px;">

    <p class="topTip_p">云专线价格=速率*标准价格*折扣，请根据申请折扣查询。</p>
    <div class="listing">
        <div class="items">
            <div class="item">
                <div class="iconDiv"><i>
                    <img src="/app/image/yunzhuanxian.png" width="22px" ;="" height="22px">
                </i></div>
                <h4 class="title">云专线</h4>
                <ul class="config_ul">
                    <li id="showSLPicker">
                        <span class="left">速率</span>
                        <div class="rightDiv">
                            <span class="left one" id="sLResult">2M</span><i class="_icon left">
                            <img src="/app/image/go_right.png">
                        </i>
                        </div>

                    </li>
                    <li id="inputDisCount">
                        <span class="left">折扣</span>
                    </li>
                </ul>
            </div>
            <div class="summary_div">
                <ul class="configInfo_ul left">
                    <li>速率<span id="sLCount" value="1">2M</span></li>

                </ul>
                <p class="price_p right " id="sL_price">￥1200</p>
                <p class="price_p right " id="sL_old_price" style="display: none"></p>
            </div>
        </div>
    </div>
</div>
<#include "foot.ftl">
<#--//九个计算值
        //CPU-->
<input type="hidden" id="total_cpu_t" name="total_cpu_t" value="0">
<input type="hidden" id="total_cpu_a" name="total_cpu_a" value="0">
<input type="hidden" id="total_cpu_d" name="total_cpu_d" value="1200">

<input hidden id="discount_name" name="discount_name" value="1">

<#--//存储-->
<input type="hidden" id="total_stat_t" name="total_stat_t" value="0">
<input type="hidden" id="total_stat_a" name="total_stat_a" value="0">
<input type="hidden" id="total_stat_d" name="total_stat_d" value="0">

<#--//带宽-->
<input type="hidden" id="total_brand_t" name="total_brand_t" value="0">
<input type="hidden" id="total_brand_a" name="total_brand_a" value="0">
<input type="hidden" id="total_brand_d" name="total_brand_d" value="0">
<input type="hidden" id="tx_sata_tag" name="tx_sata_tag" value="0">

<input type="hidden" name="flag" id="flag" value="0">
<input type="hidden" name="flagNum" id="flagNum" value="0">
<input type="hidden" name="flag_die" id="flag_die" value="1">
<input type="hidden" name="flag_die_flag" id="flag_die_flag" value="1">
<input type="hidden" name="title" id="title" value="${title}">
<input type="hidden" name="openId" id="openId" value="${openId}">
</div>
<script src="/app/js/mui.min.js"></script>
<script src="/app/js/mui.poppicker.js"></script>
<script src="/app/js/mui.picker.min.js"></script>
<script src="/app/js/yun_title.js"></script>
<script>

    $("#ali_price").text("无此规格");
    $("#tx_price").text("无此规格");
    $("#allprice").text("￥1200");
    $('#inputDisCount').click(function () {
        var total_cpu_d=document.getElementById('total_cpu_d');
        var discont=0;
        layer.prompt({title: '请输入折扣并确认,比如7折则输入数字0.7', formType: 2}, function(text, index){
            discont=text;
            layer.close(index);
            if(isNaN(discont)||discont==0||discont==null)
            {
                discont=0;
            }
            else {
                discont=parseFloat(discont.substring(0,4));
                var discount_name=document.getElementById('discount_name');
                $("#discount_name").attr("value",discont);
                var price=parseFloat(total_cpu_d.value);
                $('#sL_price').text("￥"+(price*discont).toFixed(2));
                $("#allprice").text("￥"+(price*discont).toFixed(2));
                $("#sL_old_price").text("￥"+price);
                $("#sL_old_price").css("display","block");

            }


        });
        /*var discont=prompt("请输入折扣","比如7折则输入数字0.7");
        if(isNaN(discont)||discont==0||discont==null)
        {
            discont=0;
        }
        else {
            discont=parseFloat(discont.substring(0,4));
            var discount_name=document.getElementById('discount_name');
            $("#discount_name").attr("value",discont);
            var price=parseFloat(total_cpu_d.value);
            $('#sL_price').text("￥"+(price*discont).toFixed(2));
            $("#allprice").text("￥"+(price*discont).toFixed(2));
            $("#sL_old_price").text("￥"+price);
            $("#sL_old_price").css("display","block");

        }*/
    });

    (function($, doc) {
        $.init();
        $.ready(function() {
            //速率下拉框
            var suLvPicker = new $.PopPicker();
            //CPU下拉框

            suLvPicker.setData(
                    [{value:1200,text:'2M'},
                        {value:4000,text:'10M'},
                        {value:6000,text:'20M'},
                        {value:8000,text:'30M'},
                        {value:10000,text:'40M'},
                        {value:12000,text:'50M'},
                        {value:18000,text:'100M'},
                        {value:26000,text:'150M'},
                        {value:30000,text:'200M'},
                        {value:42000,text:'300M'},
                        {value:52000,text:'400M'},
                        {value:62000,text:'500M'},
                        {value:72000,text:'600M'},
                        {value:80000,text:'700M'},
                        {value:85000,text:'800M'},
                        {value:94000,text:'900M'},
                        {value:100000,text:'1G'},
                        {value:200000,text:'2.5G'}
                    ]
            );
            var showSLPickerButton = doc.getElementById('showSLPicker');
            var sLResult = doc.getElementById('sLResult');
            var sL_price= doc.getElementById("sL_price");
            var sLCount=doc.getElementById('sLCount');
            var allprice=doc.getElementById('allprice');
            var total_cpu_d=doc.getElementById('total_cpu_d');
            var sL_old_price=doc.getElementById('sL_old_price');
            //初始化计算价格
            //CPU点击事件
            showSLPickerButton.addEventListener('tap', function(event) {
                suLvPicker.show(function(items) {
                    sL_old_price.innerHTML="";
                    sLResult.innerText = items[0].text;
                    sLCount.innerHTML=items[0].text;
                    sL_price.innerText = "￥"+items[0].value;
                    allprice.innerHTML="￥"+items[0].value;
                    total_cpu_d.value=items[0].value;
                });



            }, false);
        });
    })(mui, document);


    $('.checkInfo_right').click(function () {
        var openId=$('#openId').val();
        //VCPU
        var brand=$('#sLResult').text();
        var disCount=parseFloat($('#discount_name').val());
        var yuanJia=$('#total_cpu_d').val();
        var dis_Count;
        if(disCount==1){
            dis_Count="原价"
        }
        else {
            dis_Count=disCount+"折"
        }
        //三个价格
        var aliprice=$('#ali_price').text();
        var txprice=$('#tx_price').text();
        var allprice=$('#allprice').text();
        if(aliprice=="无此规格"){
            aliprice=0;
        }
        else {
            aliprice=aliprice.substring(1);
        }
        if(txprice=="无此规格"){
            txprice=0;
        }
        else {
            txprice=txprice.substring(1);
        }
        allprice=allprice.substring(1);

        var data1 = {
            cpuAndMem:brand,
            meMory:'',
            stat:dis_Count,
            brandNum:yuanJia,
            ali_price:aliprice,
            tx_price:txprice,
            all_price:allprice,
            productTypeId:4,
            productName:'云专线',
            oneKey:'速率',
            twoKey:'折扣',
            threeKey:'原价',
            disCount:disCount,
            oneImage:'list_icon10',
            twoImage:'list_icon9',
            threeImage:'list_icon2'
        }
        $.post("/takeList/"+openId+"/",data1,function(data){
            if(data.type=="success"){
                layer.msg(data.msg);
            }
        });
    });

</script>


</body>

</html>
